// 封装高阶组件

// const { Navigate } = require("react-router-dom");
import { Navigate } from "react-router-dom";
import { getToken } from "@/utils";

// 有token时正常跳转，无token时重定向到登录页面
export default function AuthRoute({children}){
    const token = getToken()
    if(token){
        return <> {children} </>
    }else{
        return <Navigate to={"/Login"} replace/>
    }
}